/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package racer.client.gui.entities;

import java.awt.Color;
import java.awt.Graphics;

/**
 *
 * @author Piet
 */
public abstract class Entity {
    //x-coördinaat van de locatie van deze Entity
    protected double x;
    //y-coördinaat van de locatie van deze Entity
    protected double y;
    //huidige horizontale snelheid van deze Entity (pixels/seconde)
    protected double dx = 0;
    //huidige verticale snelheid van deze Entity (pixels/seconde)
    protected double dy = 0;        
        
    public Entity(int x, int y){
        this.x = x;
        this.y = y;
    }
    
    public void move(long delta) {
        moveX(delta);
        moveY(delta);
    }
    
    public void moveX (long delta){
        x += (delta * dx) / 1000;       
    }
    
    public void moveY (long delta){
        y += (delta * dy) / 1000;
    }
    
    public void setHorizontalMovement(double dx){
        this.dx = dx;
    }
    
    public void setVerticalMovement(double dy){
        this.dy = dy;
    }
    
    public double getHorizontalMovement(){
        return dx;
    }
    
    public double getVerticalMovement(){
        return dy;
    }
    
    /**
     * tekent de Entity op de meegegeven Graphics context
    */
    public void draw(Graphics g){
        g.setColor(Color.BLUE);       
        g.fillRect((int)x,(int) y, 5,5);
    }
    
    
}
